<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>math</title>
</head>
<body>
	
	<script type="text/javascript">
	//min:求一组数字的最小值 ，Math.max()最大值
	//向上取整，Math.ceil(num)，返回值number
	var min=Math.min(47,45,2,67,88,5,42.-1);//负数不计算
	var max=Math.max(47,45,2,67,88,5,42.-1);
	console.log(min);// 2
	console.log(max);// 88   
    var num=Math.ceil(188.65);
    console.log(num);// 189
    //floor()只取整数部分，不比较大小
    var num1=Math.floor(1565.99);
    console.log(num1);//1565
    //四舍五入取整 Math.round(num);
    var num2=Math.round(15.55);
    console.log(num2);
    //取绝对值 Math.abs(num)
    var num3=Math.abs(-55);
    console.log(num3);
    //生成随机数 random();
    var random=Math.random();
    console.log(random);
    //生成一个N到M的随机数
    function getRandom(n,m){
    	var choise=m-n+1;//生成的随机整数的个数
    	return Math.floor(Math.random()*choise+n);
    }
    var random1=getRandom(1000,9999);
    console.log(random1);
	</script>
</body>
</html>